-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: font-stretch doesn't match the regex #56
Conversation
Signed-off-by: Tingyu Huang <[email protected]>
@TingyuHuang - this is looking good to me, tested with format types, will close PR #55 |
@battlesnake, this needs to be merged, open sans is affected and is a widely used font, leading to build failures with this gulp plugin e.g on bitwarden_web. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo fix is needed, the rest is up to the author to decide.
"\\s*font-family:\\s*'(?<family>[^']+)';", | ||
"\\s*font-style:\\s*(?<style>\\w+);", | ||
"\\s*font-weight:\\s*(?<weight>\\w+);", | ||
".*(?:\\s*font-stretch:\\s(?<stretch>[^;]+);)?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .* really needed?
It would actually be better if this entire "we match everything at once" would go away and we would match the stuff we really need instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A proper parser CSS parser might be useful instead of using Regexes here. I'm open to PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .* is cpoied from the pattern of unicode-range
. It could help when there are lines between font-weight
and font-stretch
. I agree that a proper CSS parser would be helpful. This PR is a quick fix.
|
||
let found = block.match(re, 'm'); | ||
if (found === null) { | ||
throw new Error("faild to match block"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, "faild" => "failed"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's fixed in #57 .
If the issue is fixed, could anyone please update npm package? |
Done, 4.1.0 |
This pull request fix the issue of font-stretch doesn't match the regex (#51) and provides an example5 for demo the issue.
Signed-off-by: Tingyu Huang [email protected]